Song time
Song time flags are used by functions such as transport.getSongPos()
to determine the units to use when referring to time within a song or pattern.
import transport
import midi
total_time_ms = transport.getSongLength(midi.SONGLENGTH_MS) # 63175
total_time_s = total_time_s // 1000
time_ms = total_time_ms % 1000
time_s = total_time_s % 60
time_mins = total_time_s // 60
print(f"Song position: {time_mins}:{time_s:02}.{time_ms:03}")
# Song position: 1:02.175
SONGLENGTH_ABSTICKS
module-attribute
Use absolute number of ticks as time unit.
This is the number of ticks since the start of the song (0
), as opposed to
SONGLENGTH_TICKS
which is the number of ticks since the last step.
A tick is the smallest time division supported by MIDI within FL Studio, and is derived by the timebase (PPQ).
SONGLENGTH_BARS
module-attribute
Use number of bars as time unit. Bars are 1-indexed.
This unit cannot be used in transport.setSongPos
.
SONGLENGTH_STEPS
module-attribute
Use number of steps since start of current bar as time unit.
A step is the subdivision of a bar used by the step sequencer, which is a 16th note by default.
This unit cannot be used in transport.setSongPos
.
SONGLENGTH_TICKS
module-attribute
Use number of ticks since start of current step as time unit.
This unit cannot be used in transport.setSongPos
.
A tick is the smallest time division supported by MIDI within FL Studio, and is derived by the timebase (PPQ).